cmake_minimum_required(VERSION 3.9)

project(multigateway LANGUAGES C)

include(CTest)

set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)
set(CMAKE_C_STANDARD 90)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(mg_sources
    src/message_loop/message_loop.c
    src/depth_meter_port.c
    src/obstacle_avoidance_sonar.c
    src/inside_can.c
    src/outside_can.c
    src/ctd422.c
    src/main.c)

list(APPEND mg_sources tools/sonar_test_tool.c)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  list(APPEND mg_sources src/linux/rngLib.c src/linux/linux_porting.c)
endif()
add_executable(multigw.elf ${mg_sources})
target_include_directories(
  multigw.elf
  PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
          $<INSTALL_INTERFACE:include>
  PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
